<?php

namespace app\controller;

use app\APIResponse;
use app\BaseController;

class User extends BaseController {

    public function list() {
        // 获取所有参数
        $params = input();

        // http://www.momo.com/user/list?pageNum=1&pageSize=10&name=hello
        $validate = validate([
            "pageNum"  => "require|number",
            "pageSize" => "require|number",
        ]);

        if (!$validate->check($params)) {
            return APIResponse::error($validate->getError(), 400);
        }

        return APIResponse::success([
            "code"   => 0,
            "params" => $params
        ]);
    }
}